<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="vesselForm.title"/></title>
    <meta name="heading" content="<fmt:message key='vesselForm.heading'/>"/>
    <meta name="menu" content="vesselFormMenu"/>
    <script type="text/javascript" src="<c:url value='/scripts/jquery/ui/jquery.ui.button.js'/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/jquery/ui/jquery.ui.datepicker.js'/>"></script>
    <style>
		#toolbar {
			padding: 10px 10px;
		}
		#toolbar2 {
			padding: 10px 10px;
		}
		#vesselName,#vesselCode,#vesselAge,#vesselWeight,#vesselCountry,#vesselDescription{
			height: 20px;
			margin-right: 20px;
			margin-top: 12px;
		}
		
	</style>
</head>


<div class="buttons" style="float:left;padding-right:15px;margin-top: 20px;">
	<form:form commandName="vessel" method="post" action="vesselForm.html" onsubmit="return onFormSubmit(this)" id="vesselForm">
		<form:hidden path="id"/>
		<span id="toolbar" class="ui-widget-header ui-corner-all">
			<button type="submit" id="add_maven" class="button" name="save" onclick="bCancel=false">
				<fmt:message key="button.save"/>
			</button>
		
			<c:if test="${param.from == 'list' and param.method != 'Add'}">
				<button type="submit" id="delete_maven" class="button" name="delete" onclick="bCancel=true;return confirmDelete('Vessel Data')">
					<fmt:message key="button.delete"/>
			    </button>
			</c:if>
		
		    <button type="submit" id="cancel_maven" class="button" name="cancel" onclick="location.href='<c:url value="/admin/vesselList.*"/>'">
		    	 <fmt:message key="button.cancel"/>
		    </button>
		</span>
		
		<div class="clear"></div>
		
		<fieldset class="ui-widget ui-widget-content" style="width: 125%;margin-top: 12px; margin-bottom: 12px;">
			<legend class="ui-widget-header ui-corner-all" style="height: 12px;">
				<fmt:message key="vessel.InformationVessel" />
			</legend>
			<table>
				<tr>
					<td> <appfuse:label styleClass="desc" key="vesselFormData.code"/></td>
					<td>
						<form:errors path="code" cssClass="fieldError"/>
						<form:input path="code" id="vesselCode" cssClass="text ui-widget-content ui-corner-all" cssErrorClass="text error"/>
					</td>
				</tr>
				<tr>
					<td> <appfuse:label styleClass="desc" key="vesselFormData.name"/></td>
					<td>
						<form:errors path="name" cssClass="fieldError"/>
						 <form:input path="name" id="vesselName" cssClass="text medium ui-widget-content ui-corner-all" cssErrorClass="text medium error"/>
					</td>
				</tr>
				<tr>
					<td> <appfuse:label styleClass="desc" key="vesselFormData.age"/></td>
					<td>
						<form:errors path="age" cssClass="fieldError"/>
						 <form:input path="age" id="vesselAge" cssClass="text small ui-widget-content ui-corner-all" cssErrorClass="text small error"/>
					</td>
				</tr>
				<tr>
					<td> <appfuse:label styleClass="desc" key="vesselFormData.weight"/></td>
					<td>
						<form:errors path="weight" cssClass="fieldError"/>
						<form:input path="weight" id="vesselWeight" cssClass="text small ui-widget-content ui-corner-all" cssErrorClass="text small error"/>
					</td>
				</tr>
				
				<tr>
					<td> <appfuse:label styleClass="desc" key="vessel.txtCountry"/></td>
					<td>
						<form:errors path="country" cssClass="fieldError"/>
						<c:choose>
				    		<c:when test="${vessel.country != null && vessel.country.id > 0}">
								<form:select path="country.id" id="vesselCountry" items="${countryList}" itemLabel="name" itemValue="id" class="select ui-widget-content ui-corner-all"/>
				    		</c:when>
				    		<c:otherwise>
								<form:select path="country" id="vesselCountry" items="${countryList}" itemLabel="name" itemValue="id" class="select ui-widget-content ui-corner-all" />
				    		</c:otherwise>
				    	</c:choose>
					</td>
				</tr>
				<tr>
					<td> <appfuse:label styleClass="desc" key="vesselFormData.description"/></td>
					<td colspan="3">
						<form:errors path="description" cssClass="fieldError"/>
						 <form:input path="description" id="vesselDescription" cssClass="text large ui-widget-content ui-corner-all" cssErrorClass="text large error"/>
					</td>
				</tr>
			</table>
		</fieldset>
		
		<span id="toolbar2" class="ui-widget-header ui-corner-all">
			<button type="submit" id="add_maven2" class="button" name="save" onclick="bCancel=false">
				<fmt:message key="button.save"/>
			</button>
		
			<c:if test="${param.from == 'list' and param.method != 'Add'}">
				<button type="submit" id="delete_maven2" class="button" name="delete" onclick="bCancel=true;return confirmDelete('Vessel Data')">
					<fmt:message key="button.delete"/>
			    </button>
			</c:if>
		
		    <button type="submit" id="cancel_maven2" class="button" name="cancel" onclick="location.href='<c:url value="/admin/vesselList.*"/>'">
		    	 <fmt:message key="button.cancel"/>
		    </button>
		</span>
	</form:form>
</div>

<script type="text/javascript">
	$("#add_maven" ).button({
	    icons: {
	        primary: "ui-icon-circle-plus"
	    }
	});
	
	$("#delete_maven" ).button({
	    icons: {
	        primary: "ui-icon-circle-minus"
	    }
	});
	
	$("#cancel_maven" ).button({
	    icons: {
	        primary: "ui-icon-circle-close"
	    }
	});
	
	$("#add_maven2" ).button({
	    icons: {
	        primary: "ui-icon-circle-plus"
	    }
	});
	
	$("#delete_maven2" ).button({
	    icons: {
	        primary: "ui-icon-circle-minus"
	    }
	});
	
	$("#cancel_maven2" ).button({
	    icons: {
	        primary: "ui-icon-circle-close"
	    }
	});
</script>